/***********************************************************************
 * Module:  Class.java
 * Author:  Stefan
 * Purpose: Defines the Class Class
 ***********************************************************************/
package org.dslintegration.merge.km3.core;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class Class extends Classifier {
	protected boolean isAbstract;

	protected List<StructuralFeature> structuralFeatures = new ArrayList<StructuralFeature>();
	protected String superType = null;
	protected Class superTypeRef = null;

	public Class() {
	}

	public Class(String name, boolean isAbstract) {
		this.name = name;
		this.isAbstract = isAbstract;
	}

	// Get the attributes from the class
	public List<Attribute> getAttributes() {
		List<Attribute> attributes = new ArrayList<Attribute>();
		for (StructuralFeature feature : structuralFeatures) {
			if (feature instanceof Attribute) {
				attributes.add((Attribute) feature);
			}
		}
		return attributes;
	}

	// Get the references from the class
	public List<Reference> getReferences() {
		List<Reference> attributes = new ArrayList<Reference>();
		for (StructuralFeature feature : structuralFeatures) {
			if (feature instanceof Reference) {
				attributes.add((Reference) feature);
			}
		}
		return attributes;
	}

	public boolean isAbstract() {
		return isAbstract;
	}

	public void setAbstract(boolean isAbstract) {
		this.isAbstract = isAbstract;
	}

	public List<StructuralFeature> getStructuralFeatures() {
		return structuralFeatures;
	}

	public void setStructuralFeatures(List<StructuralFeature> structuralFeature) {
		this.structuralFeatures = structuralFeature;
	}
	
	public String getSuperType(){
		return superType;
	}
	
	public void setSuperType(String type){
		superType = type;
	}

	public void addStructuralFeature(StructuralFeature feature) {
		this.structuralFeatures.add(feature);
	}

	

	public Class getSuperTypeRef() {
		return superTypeRef;
	}

	public void setSuperTypeRef(Class superTypeRef) {
		this.superTypeRef = superTypeRef;
	}

	@Override
	public String toString() {
		return "\n\t\tClass [isAbstract=" + isAbstract + ", name=" + name + ", location=" + location + ", structuralFeature=" + structuralFeatures + ", superTypes=" + superType
				+ "]";
	}







}